import {
  createRouter,
  // createWebHistory,
  createWebHashHistory
} from 'vue-router'

// console.log(import.meta)
// 1. history 模式使用 createWebHistory()
// 2. hash 模式使用 createWebHashHistory()
// 3. 参数是基础路径，默认/
const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      component: () => import('@/views/Login/index.vue')
    },
    {
      path: '/',
      component: () => import('@/views/Layout/index.vue'),
      redirect: '/home',
      children: [
        {
          path: 'home',
          component: () => import('@/views/Home/index.vue')
        },
        {
          path: 'notify',
          component: () => import('@/views/Notify/index.vue')
        },
        {
          path: 'user',
          component: () => import('@/views/User/index.vue')
        },
        {
          path: 'article',
          component: () => import('@/views/Article/index.vue')
        }
      ]
    }
  ]
})

export default router
